News All Tests
Current file: /home/estudydev/workspace/MSP09/web/news/tests/class.newscategoryquiz.inc.php
Legend: executed not executed dead code

  Coverage
  Classes Methods Lines
Total
100.00 %100.00%
100.00% 1 / 1
0.00 %0.00%
0.00% 0 / 6
5.71 %5.71%
5.71% 2 / 35
 
NewsCategoryQuiz
100.00 %100.00%
100.00% 1 / 1
0.00 %0.00%
0.00% 0 / 6
2.94 %2.94%
2.94% 1 / 34
 public function __construct($catID, $courses, $categorySettings = NULL, $cacheObject = NULL)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 4
 public function isInstalled($courseID)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function canSelectPeriod()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function getNewsHeaderTitle($courseID = NULL, $type = NULL)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 4
 protected function getNewsByPeriod($courseID, $from, $to, $lastvisit, $usergroup = NULL)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 13
 protected function echoNewsEntry($entry, $courseID, $usergroup = NULL)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 10


       1                 : <?php                                                                                                                             
       2                 : /*--------------------------------------------------------------------------+                                                     
       3                 : This file is part of eStudy.                                                                                                      
       4                 : news/classes/class.NewsCategoryQuiz.inc.php                                                                                       
       5                 : - Modulgruppe:  News                                                                                                              
       6                 : - Beschreibung: Klasse für die News-Kategorie Quiz.                                                                              
       7                 : - Version:      1.1.2.4, 24/01/08                                                                                                 
       8                 : - Autor(en):    Corinna Kropf <corinna.kropf@mni.fh-giessen.de>                                                                   
       9                 : +---------------------------------------------------------------------------+                                                     
      10                 : This program is free software; you can redistribute it and/or                                                                     
      11                 : modify it under the terms of the GNU General Public License                                                                       
      12                 : as published by the Free Software Foundation; either version 2                                                                    
      13                 : of the License, or any later version.                                                                                             
      14                 : +---------------------------------------------------------------------------+                                                     
      15                 : This program is distributed in the hope that it will be useful,                                                                   
      16                 : but WITHOUT ANY WARRANTY; without even the implied warranty of                                                                    
      17                 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                                                     
      18                 : GNU General Public License for more details.                                                                                      
      19                 : You should have received a copy of the GNU General Public License                                                                 
      20                 : along with this program; if not, write to the Free Software                                                                       
      21                 : Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                                                       
      22                 : +--------------------------------------------------------------------------*/                                                     
      23                 :                                                                                                                                   
      24               1 : require_once ("class.newscategory.inc.php");                                                                                      
      25                 :                                                                                                                                   
      26                 : /**                                                                                                                               
      27                 :  * Klasse für die News-Kategorie Quiz.                                                                                           
      28                 :  * @package eStudy.News                                                                                                           
      29                 :  * @version 1.1.2.4, 24/01/08                                                                                                     
      30                 :  * @author  Corinna Kropf <corinna.kropf@mni.fh-giessen.de>                                                                       
      31                 :  */                                                                                                                               
      32               1 : class NewsCategoryQuiz extends NewsCategory                                                                                       
      33                 : {                                                                                                                                 
      34                 :     /**                                                                                                                           
      35                 :      * Cache Objekt zur Abfrage von Modulinstallationen (Performance Tweak)                                                       
      36                 :      * @var array                                                                                                                 
      37                 :      */                                                                                                                           
      38                 :     private $installCacheObject;                                                                                                  
      39                 :    /**                                                                                                                            
      40                 :      * HTML-Template                                                                                                              
      41                 :      * @var Template                                                                                                              
      42                 :      */                                                                                                                           
      43                 :     private $newsTemplate;                                                                                                        
      44                 :     /**                                                                                                                           
      45                 :      * Konstruktor                                                                                                                
      46                 :      */                                                                                                                           
      47                 :     public function __construct($catID, $courses, $categorySettings = null, $cacheObject = null)                                  
      48                 :     {                                                                                                                             
      49               0 :         parent::__construct($catID, $courses, $categorySettings);                                                                 
      50               0 :         $this->installCacheObject = $cacheObject;                                                                                 
      51               0 :         $this->newsTemplate = new Template(PATH_TO_ROOT."news/templates/newsquiz.html");                                          
      52               0 :     }                                                                                                                             
      53                 :     /**                                                                                                                           
      54                 :      * Muss angepasst werden, falls Modulgruppen umbenannt werden!                                                                
      55                 :      * @see NewsCategory                                                                                                          
      56                 :      */                                                                                                                           
      57                 :     public function isInstalled($courseID)                                                                                        
      58                 :     {                                                                                                                             
      59               0 :         return Utilities::isInstalled("quiz", $courseID, $this->installCacheObject);                                              
      60                 :     }                                                                                                                             
      61                 :     /**                                                                                                                           
      62                 :      * @see NewsCategory                                                                                                          
      63                 :      */                                                                                                                           
      64                 :     public function canSelectPeriod() {                                                                                           
      65               0 :         return true;                                                                                                              
      66                 :     }                                                                                                                             
      67                 :     /**                                                                                                                           
      68                 :      * @see NewsCategory                                                                                                          
      69                 :      */                                                                                                                           
      70                 :     public function getNewsHeaderTitle($courseID = null, $type = null) {                                                          
      71               0 :         $newsCount = $this->news["count"];                                                                                        
      72               0 :         if ($newsCount > 0) $title = sprintf( $this->translate->_("%1\$s Lernquiz"), $newsCount);                                 
      73               0 :         else $title = $this->translate->_("Keine neuen Lernquiz");                                                                
      74                 :                                                                                                                                   
      75               0 :         return $title;                                                                                                            
      76                 :     }                                                                                                                             
      77                 :                                                                                                                                   
      78                 :     /**                                                                                                                           
      79                 :      * @see NewsCategory                                                                                                          
      80                 :      */                                                                                                                           
      81                 :     protected function getNewsByPeriod($courseID, $from, $to, $lastvisit, $usergroup = null)  {                                   
      82                 :         // Neue Lernquiz/Klausuren                                                                                                
      83               0 :         if (isset($courseID) && isset($lastvisit) && isset($this->coursePreferences))                                             
      84               0 :         {                                                                                                                         
      85               0 :             if(!is_numeric($courseID) || !is_numeric($lastvisit)) return null;                                                    
      86                 :                                                                                                                                   
      87               0 :             global $db;                                                                                                           
      88               0 :             $this->news = array();                                                                                                
      89                 :                                                                                                                                   
      90                 :             $sql =   "SELECT * FROM quiz_exam JOIN quiz_course_exam ON quiz_exam.ExamID=quiz_course_exam.ExamID "                 
      91               0 :                     ."WHERE Start>='".Data::toMysql(Output::echoDate("Y-m-d", (int)$this->getPeriod($courseID, $lastvisit))) ."' "
      92               0 :                     ."AND Start<='".Data::toMysql(Output::echoDate("Y-m-d H:i:s")) ."' "                                          
      93               0 :                     ."AND CourseID='".Data::toMysql($courseID)."'";                                                               
      94               0 :             $this->news["data"] = $db->get_results($sql, ARRAY_A);                                                                
      95               0 :             if ($db->num_rows > 0) $this->news["count"] = $db->num_rows;                                                          
      96               0 :             else $this->news = null;                                                                                              
      97               0 :         }                                                                                                                         
      98                 :                                                                                                                                   
      99               0 :         return $this->news;                                                                                                       
     100                 :     }                                                                                                                             
     101                 :     /**                                                                                                                           
     102                 :      * @see NewsCategory                                                                                                          
     103                 :      */                                                                                                                           
     104                 :     protected function echoNewsEntry($entry, $courseID, $usergroup = null)                                                        
     105                 :     {                                                                                                                             
     106               0 :         if(!isset($entry) || !isset($courseID)) return;                                                                           
     107                 :                                                                                                                                   
     108               0 :         $examArt = Data::toHTML($entry["Exam_Art"], false);                                                                       
     109               0 :         $quizName = Data::toHTML($entry["Name"], false);                                                                          
     110               0 :         $quizDesc = Utilities::chopText($entry["Beschreibung"], 150);                                                             
     111               0 :         $scriptPath = PATH_TO_ROOT."quiz/showExams.php";                                                                          
     112               0 :         $quizExamID = Data::toHTML($entry["ExamID"], false);                                                                      
     113               0 :         $courseChange = ($courseID ? "&amp;changeToCourse=".Data::toHTML($courseID, false) : "");                                 
     114                 :                                                                                                                                   
     115               0 :         $g_Lesen = $this->translate->_("Lesen");                                                                                  
     116                 :                                                                                                                                   
     117               0 :         eval($this->newsTemplate->GetTemplate());                                                                                 
     118               0 :     }                                                                                                                             
     119                 : }                                                                                                                                 

Generated by PHPUnit 3.2.21 and Xdebug 2.0.4 at Sat Nov 7 22:04:08 CET 2009.